package com.xnyzc.lhy.mis.controller.cmsapi.synchronous;

import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.common.penum.EErrorCode;
import com.xnyzc.lhy.mis.service.cms.synchronous.SynchronousService;
import com.xnyzc.lhy.resource.entity.worksheet.param.heli.LoginSynchronousParam;
import com.xnyzc.lhy.resource.entity.worksheet.param.heli.RoleSynchronousParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 同步数据相关
 *
 * @Author: wangshuo
 * @Date: 2019-11-04 14:11
 */
@RestController
@RequestMapping("/cmsapi/synchronous")
public class SynchronousController {

    @Autowired
    private SynchronousService synchronousService;

    /**
     * 登陆账号同步接口
     *
     * @return
     */
    @ApiOperation(value = "登陆账号同步接口", notes = "登陆账号同步接口")
    @PostMapping(value = "/getLoginSynchronous")
    public Rv getLoginSynchronous(
            @ApiParam(name = "loginSynchronousParam", value = "登陆账号同步接口") @RequestBody LoginSynchronousParam loginSynchronousParam
    ) {
        try {
            return synchronousService.getLoginSynchronous(loginSynchronousParam);
        }catch (Exception ex){
            return Rv.error(EErrorCode.unkown);
        }
    }

    /**
     * 客服角色同步接口。
     *
     * @return
     */
    @ApiOperation(value = "客服角色同步接口", notes = "客服角色同步接口")
    @PostMapping(value = "/getRoleSynchronous")
    public Rv getRoleSynchronous(
            @ApiParam(name = "roleSynchronousParam", value = "登陆账号同步接口") @RequestBody RoleSynchronousParam roleSynchronousParam
    ) {
        try {
            return synchronousService.getRoleSynchronous(roleSynchronousParam);
        }catch (Exception ex){
            return Rv.error(EErrorCode.unkown);
        }
    }

}
